<?php
/**
 * model base class
 * @link http://webappkit.net
 * @package dj
 * @subpackage models
 * @author J.Ducastel <nospam0@ducastel.name>
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 */

class DjModel {

    /**
     * get the objects manager
     * all subclasses have to implement their own !!
     * @return DjManager
     */
    public static function objects() {
        static $managers=array();

    }

    /**
     * constructor
     * accepts an array to load self properties
     * @param array $data
     */
    public function __construct($data=array()) {
        foreach ($data as $key => $value) {
            $this->$key=$value;
        }
    }

    /**
     * save object
     * @param bool $force_insert
     * @param bool $force_update
     * @return bool
     */
    public function save($force_insert=false,$force_update=false) {

    }

    /**
     * @return bool
     */
    public function delete() {

    }

    /**
     * actual saving function
     * @return bool
     */
    private function _save($force_insert=false,$force_update=false) {
        // build SQL
    }
}